Skip to content

async_hooks: improve resource stack performance#33575

Closed
addaleax wants to merge 1 commit intonodejs:masterfrom
addaleax:async-resource-improvements
Closed

async_hooks: improve resource stack performance#33575
addaleax wants to merge 1 commit intonodejs:masterfrom
addaleax:async-resource-improvements

Conversation

@addaleax
Copy link
Member

Removes some of the performance overhead that came with
executionAsyncResource() by storing async resources that
are managed by JS and those managed by C++ separately, and
instead caching the result of executionAsyncResource() with
low overhead to avoid multiple calls into C++.

This particularly improves performance when async hooks are not
being used.

$ ./node benchmark/compare.js --new ./node --old ./node-master --runs 30 --filter messageport worker | Rscript benchmark/compare.R
[00:04:41|% 100| 1/1 files | 60/60 runs | 2/2 configs]: Done
                                                   confidence improvement accuracy (*)    (**)   (***)
 worker/messageport.js n=1000000 payload='object'          *      8.85 %       ±7.40%  ±9.85% ±12.83%
 worker/messageport.js n=1000000 payload='string'        ***     18.56 %       ±8.37% ±11.13% ±14.49%

(I’ll also try to run the async_hooks benchmarks, but they are failing locally for me on master – hence only the ones for MessagePorts as another measure.)

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

async_hooks Issues and PRs related to the async hooks subsystem. c++ Issues and PRs that require attention from people who are familiar with C++. performance Issues and PRs related to the performance of Node.js.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants